<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> 
<style>
.editor table {
	display: inline;
	vertical-align: top;
}

</style>
<div class="r_location">
	<i class="r_txtico"></i> 内容管理&gt; 课时管理 &gt; 修改课时
</div>
<form id="add_form" action="cms/course/modify"   method="post" >
<input type="hidden" id="stats"  name="stats" value="${data.stats}" />
<input type="hidden" id="id"  name="id" value="${data.id}" />

	<ul class="all_list">
		<li><span class="all_title">课时类型：</span>
		 <span>
					<select name="type" id="type" validator='{"label":"类型"}' class="ui_select">
						<option value="" >请选择</option>
						<option value="1" <c:if test="${data.type == 1}">selected="selected"</c:if>>PS基础</option>
						<option value="2" <c:if test="${data.type == 2}">selected="selected"</c:if>>PS中级</option>
						<option value="3" <c:if test="${data.type == 3}">selected="selected"</c:if>>PS高级</option>
						<option value="4" <c:if test="${data.type == 4}">selected="selected"</c:if>>摄影基础</option>
						<option value="5" <c:if test="${data.type == 5}">selected="selected"</c:if>>摄影中级</option>
						<option value="6" <c:if test="${data.type == 6}">selected="selected"</c:if>>摄影高级</option>
						<option value="7" <c:if test="${data.type == 7}">selected="selected"</c:if>>活动</option>
						<option value="8" <c:if test="${data.type == 8}">selected="selected"</c:if>>讲座</option>
				</select>
			</span>
			</li>
			<li>
		 	<span class="all_title">课程（活动，讲座）名字：</span> <span> <input
				class="ui_input" id="name"
				validator='{"label":"排序","isDigit":false,"minLength":1,"maxLength":20}'
				name="name" style="width: 100px;" value="${data.name}"/>
		</span></li>
		<li>
			<span class="all_title">课时：</span>
			<span>
				<input class="ui_input" id="classHour" validator='{"label":"名称","isDigit":true,"minLength":1,"maxLength":50}'  name="classHour" style="width:100px;" value="${data.classHour}"/>
			</span>
		</li>
		<li>
			<span class="all_title">老师：</span>
			<span>
				<input class="ui_input" id="teacher" validator='{"label":"名称","isDigit":false,"minLength":1,"maxLength":50}'  name="teacher" style="width:100px;" value="${data.teacher}"/>
			</span>
		</li>
		<li>
				<span class="all_title">推送时间：</span> 
				<span>
					<input type="text" id="pushTime" name="pushTime" class="ui_input datepicker Wdate" dateFormat="yyyy-MM-dd HH:mm:ss" group='{"group": {"startId":"pushTime", "endId":"pushTime","showNext": true}}' option='start-auto-end' value="${data.pushTime}"/> 
				</span>
			</li>
		<li>
				<span class="all_title">上课时间：</span> 
				<span>
					<input type="text" id="time" name="time" class="ui_input datepicker Wdate" dateFormat="yyyy-MM-dd HH:mm:ss" group='{"group": {"startId":"time", "endId":"time","showNext": true}}' option='start-auto-end' value="${data.time}"/>
				</span>
			</li>
		<li class="editor"><span class="all_title">课程描述</span> <span>
				<textarea id="content" name="remark"
					class="xheditor {tools:'FontSize,FontColor,Bold,Italic,Underline,Strikethrough,Fullscreen,Align,About',skin:'default',height:'300'}"
					rows="8" cols="80" style="width: 70%">${data.remark}
				</textarea> <span id="contentError"></span>
		</span></li>
		<li>
			<span class="all_title"></span>
			<span>
				<input type="button" id="addBtn" value="保存" class="btn_blue m-r15 submitBtn">
			</span>
		</li>
	</ul>
</form>
<script type="text/javascript">
	$(function(){
		$.datepicker();
		$('#content').xheditor();
		function showDialog(url, options) {
			myDialog = art.dialog(options);// 初始化一个带有loading图标的空对话框
			$.post(url, options.param, function(data) {
				myDialog.content(data);
			});
		}
		$("#add_form").validator({}, {
			callback:function(data){
				if (!$('#type').val()) {
					alert("类型不能为空");
					return false;
				}
				if (!$('#name').val()) {
					alert("名字不能为空");
					return false;
				}
				if (!$('#classHour').val()) {
					alert("课时不能为空");
					return false;
				}
				if (!$('#teacher').val()) {
					alert("老师不能为空");
					return false;
				}
				if (!$('#pushTime').val()) {
					alert("推送时间不能为空");
					return false;
				}
				if (!$('#time').val()) {
					alert("上课时间不能为空");
					return false;
				}
				if (!$('#id').val()) {
					alert("id不能为空");
					return false;
				}
				if (!$('#content').val()) {
					$('#contentError').html('内容不能为空!').addClass('frame_error');
					return false;
				} else {
					$('#contentError').html('').removeClass('frame_error');
				}
				$("#add_form").ajaxSubmit(function(data){
					if (data.success == 'succeed') {
						to_page('/cms/course/view/page');
					} else {
						art.dialog({icon: data.success,content: data.message,lock:true});
					}
				}); 
			}
		});
 	});
		
</script>